package cz.cuni.amis.episodic.bayes.experiment;

import cz.cuni.amis.episodic.bayes.memories.MemoryCreationStrategy;
import cz.cuni.amis.episodic.bayes.utils.DynamicNodeProperty;
import cz.cuni.amis.episodic.bayes.utils.chart.GraphPaintingDevice;
import cz.cuni.amis.episodic.bayes.utils.chart.PngGraphDevice;
import cz.cuni.amis.episodic.dybanem.DBN;
import cz.cuni.amis.episodic.lisp.LispPlanResourceCreator;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import smile.Network;

/**
 * Shows high level goal self organization through EM algorithm.
 * @author ik
 */
public class Experiment_8_selfOrg {
    public static void main(String[] args) throws FileNotFoundException, IOException, Exception {
        
        LispPlanResourceCreator.processCorpus("../datasets/8_selfOrg/8.lisp",
        new File("../datasets/8_selfOrg/"), 2, 4);
        
        Network origNet = new Network();
        origNet.readFile("../datasets/8_selfOrg/8_hhmm_learned.xdsl");

        List<String> evidence = Arrays.asList("A_atomic", "E_atomic", "C_atomic");

        DBN net = new DBN(origNet, evidence.size());

        String[] targets = new String[]{"O", "G1"};
        List<DynamicNodeProperty[]> res = Experiment_2.evolveOverTime(net, "O", evidence, targets);

        // draw default graphs      
        GraphPaintingDevice graphDevice = new PngGraphDevice("target/experiments/8/graphs/");
        //MemoryChartCreator.createDefaultCharts(res, net, graphDevice);

        MemoryCreationStrategy.compare(evidence, net, targets, graphDevice);
        
    }
    
}
